package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;

import java.util.Random;

@Service
public class HelloServiceImpl implements HelloService {
    @Override
    public String methodA() {
        Random random = new Random();
        try {
            Thread.sleep(random.nextInt(101));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodA";
    }

    @Override
    public String methodB() {
        Random random = new Random();
        try {
            Thread.sleep(random.nextInt(101));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodB";
    }

    @Override
    public String methodC() {
        Random random = new Random();
        try {
            Thread.sleep(random.nextInt(101));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodC";
    }
//    @Override
//    public String sayHello(String name) {
//        String remoteHost = RpcContext.getContext().getRemoteHost();
//        System.out.println(remoteHost);
//        return "service-provider:hello :"+name;
//    }

}
